<?php
class PageCtrl extends ControllerBase {
    public function Index() {
        $resources = Doctrine_Core::getTable('Localization')
            ->createQuery('l')
            ->select("l.title, l.body")
            ->innerJoin('l.pageLocalization pl')
            ->where('l.language = "'.$this->lang.'" and pl.page_id = '.$this->id)
            ->fetchArray();

        $title = "missing title resource";
        $body = "missing body resource";
        if($resources != null){
            $resources = $resources[0];
            $title = $resources["title"];
            $body = $resources["body"];
        }

        parent::Script("<script></script>");
        parent::Title($title);

        $this->assign("pagetitle", $title);
        $this->assign("pagebody", $body);
    }
}
